extends Node2D

@onready var tileMap :TileMap=$TileMap
@onready var player:Player=$玩家
@onready var camera:Camera2D=$玩家/Camera2D

func _ready() -> void:
  getRect()

# 获取地图的边界
func getRect():
  var mapRect :=tileMap.get_used_rect()
  var tileSize:=tileMap.tile_set.tile_size
  camera.limit_top = mapRect.position.y*tileSize.y
  camera.limit_left = mapRect.position.x*tileSize.x
  camera.limit_right = mapRect.end.x*tileSize.x
  camera.limit_bottom = mapRect.end.y*tileSize.y
  camera.reset_smoothing()




